<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Main extends CI_Controller {

	function __construct() {
    parent::__construct();	
		$this->load->model('main_model');
		$this->load->model('post_model');
		$this->load->model('portofolio_model');
		$this->load->model('career_model');
		$this->load->model('jpekerjaan_model');
		$this->load->helper('text');
	}

	public function index(){
		$data['main_content']='main_content';
		$data['judul']='Time Excelindo | ICT Service Provider';
		$data['list_produk']=$this->main_model->get_produk();
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_news']=$this->main_model->get_news();
		$data['list_slider']=$this->main_model->get_slider();
		$data['list_client']=$this->main_model->get_client();
		$data['list_chart'] = $this->jpekerjaan_model->getData4JSon();
		$data['list_pekerjaan'] = $this->jpekerjaan_model->getData4JSonDetail();
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		
		//buat meta deskripsi
		$data['meta_deskripsi']='ICT Service Provider';
		$data['seo_gambar']=base_url()."asset/images/logo_te.jpg";
		$data['meta_tags']='te,TE,time excelindo,Time Excelindo, timeexcelindo, TimeExcelindo, website, website enterprise, sms, sms center, airport system, airport pas, airport pas management system, airport safety, aiport safety management system, smartcard, smart card, rfid, rfid solution, file payment for banking, file payment banking, converter payment banking, build software, costome software, build costome software, system integration, mobile application, cobit implementation, itil implementation, service management, risk management, cloud, cloud computing, network security, data center, disaster recovery center, cctv indoor, cctv outdoor, dedicated server, domain, hosting, domain hosting, lan, wan, fiber optic, intercity, dedicated line, peering, mpls, ip transit, ipv4, ipv6, management information system, information system, mis, indonesia, project, information enginering, tenaga ahli, ngo, open source, Online Project Management, Project Scope, Web Project Management,Project Risk Management,Project Management Consulting,Project Management Tools,Project Management Planning, IT project management, IT project performance management';
		//echo get_tree_menu();
		//exit;
		$this->load->view('home',$data);
	}
	
	function all_news($offset = 0){
		$data['judul']='Berita | Time Excelindo';
		$data['main_content']='all_news';
		$uri_segment = 3;
		
		if($offset != 0){
			$offset = $this->uri->segment($uri_segment);
		}else{
			$offset=$offset;
		}
		$num_post=5;
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['hasil']=$this->post_model->getData($num_post, $offset);
		$data['offset']=$offset;
		$num_rows = $this->post_model->count_all_num_rows();
		//buat meta deskripsi
		$data['meta_deskripsi']='ICT Service Provider';
		$data['seo_gambar']=base_url()."asset/images/logo_te.jpg";
		$data['meta_tags']='te,TE,time excelindo,Time Excelindo, timeexcelindo, TimeExcelindo, website, website enterprise, sms, sms center, airport system, airport pas, airport pas management system, airport safety, aiport safety management system, smartcard, smart card, rfid, rfid solution, file payment for banking, file payment banking, converter payment banking, build software, costome software, build costome software, system integration, mobile application, cobit implementation, itil implementation, service management, risk management, cloud, cloud computing, network security, data center, disaster recovery center, cctv indoor, cctv outdoor, dedicated server, domain, hosting, domain hosting, lan, wan, fiber optic, intercity, dedicated line, peering, mpls, ip transit, ipv4, ipv6, management information system, information system, mis, indonesia, project, information enginering, tenaga ahli, ngo, open source, Online Project Management, Project Scope, Web Project Management,Project Risk Management,Project Management Consulting,Project Management Tools,Project Management Planning, IT project management, IT project performance management';
			
		if($num_rows>0){
			// Membuat pagination
			$config['base_url'] = base_url().'main/all_news';
			$config['cur_tag_open'] = '<li class=active><a href="#">';
			$config['cur_tag_close'] = '<span class="sr-only">(current)</span></a></li>';
			$config['num_tag_open'] = '<li>';
			$config['num_tag_close'] = '</li>';
			$config['prev_link'] = '<';
			$config['prev_tag_open'] = '<li>';
			$config['prev_tag_close'] = '</li>';
			$config['next_link'] = '>';
			$config['next_tag_open'] = '<li>';
			$config['next_tag_close'] = '</li>';
			//buat last
			$config['last_tag_open'] = '<li>';
			$config['last_tag_close'] = '</li>';
			$config['last_link'] = '>>';
			//buat first
			$config['first_tag_open'] = '<li>';
			$config['first_tag_close'] = '</li>';
			$config['first_link'] = '<<';
			$config['total_rows'] = $num_rows;
			$config['per_page'] = $num_post;
			$config['num_links'] = 3;
			$config['uri_segment'] = $uri_segment;
			$this->pagination->initialize($config);
			$data['pagination'] = $this->pagination->create_links();
		}
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		$this->load->view('home',$data);
	}
	
	function all_client(){
		$data['judul']='Client | Time Excelindo';
		$data['main_content']='all_client';
		//buat meta deskripsi
		$data['meta_deskripsi']='ICT Service Provider';
		$data['seo_gambar']=base_url()."asset/images/logo_te.jpg";
		$data['meta_tags']='te,TE,time excelindo,Time Excelindo, timeexcelindo, TimeExcelindo, website, website enterprise, sms, sms center, airport system, airport pas, airport pas management system, airport safety, aiport safety management system, smartcard, smart card, rfid, rfid solution, file payment for banking, file payment banking, converter payment banking, build software, costome software, build costome software, system integration, mobile application, cobit implementation, itil implementation, service management, risk management, cloud, cloud computing, network security, data center, disaster recovery center, cctv indoor, cctv outdoor, dedicated server, domain, hosting, domain hosting, lan, wan, fiber optic, intercity, dedicated line, peering, mpls, ip transit, ipv4, ipv6, management information system, information system, mis, indonesia, project, information enginering, tenaga ahli, ngo, open source, Online Project Management, Project Scope, Web Project Management,Project Risk Management,Project Management Consulting,Project Management Tools,Project Management Planning, IT project management, IT project performance management';
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$list_kategori=$this->main_model->get_all_kategori();
		foreach($list_kategori as $val){
			$list_client[$val['id_kategori']]=$this->main_model->get_client_by_kategori($val['id_kategori']);
		}
		$data['list_kategori']=$list_kategori;
		$data['list_client']=$list_client;
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		$this->load->view('home',$data);
	}
	
	function all_product(){
		$data['judul']='Products | Time Excelindo';
		$data['main_content']='all_product';
		//buat meta deskripsi
		$data['meta_deskripsi']='ICT Service Provider';
		$data['seo_gambar']=base_url()."asset/images/logo_te.jpg";
		$data['meta_tags']='te,TE,time excelindo,Time Excelindo, timeexcelindo, TimeExcelindo, website, website enterprise, sms, sms center, airport system, airport pas, airport pas management system, airport safety, aiport safety management system, smartcard, smart card, rfid, rfid solution, file payment for banking, file payment banking, converter payment banking, build software, costome software, build costome software, system integration, mobile application, cobit implementation, itil implementation, service management, risk management, cloud, cloud computing, network security, data center, disaster recovery center, cctv indoor, cctv outdoor, dedicated server, domain, hosting, domain hosting, lan, wan, fiber optic, intercity, dedicated line, peering, mpls, ip transit, ipv4, ipv6, management information system, information system, mis, indonesia, project, information enginering, tenaga ahli, ngo, open source, Online Project Management, Project Scope, Web Project Management,Project Risk Management,Project Management Consulting,Project Management Tools,Project Management Planning, IT project management, IT project performance management';
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		$this->load->view('home',$data);
	}
	
	function all_career($offset = 0){
		$data['judul']='Career | Time Excelindo';
		$data['main_content']='career';
		//buat meta deskripsi
		$data['meta_deskripsi']='ICT Service Provider';
		$data['seo_gambar']=base_url()."asset/images/logo_te.jpg";
		$data['meta_tags']='te,TE,time excelindo,Time Excelindo, timeexcelindo, TimeExcelindo, website, website enterprise, sms, sms center, airport system, airport pas, airport pas management system, airport safety, aiport safety management system, smartcard, smart card, rfid, rfid solution, file payment for banking, file payment banking, converter payment banking, build software, costome software, build costome software, system integration, mobile application, cobit implementation, itil implementation, service management, risk management, cloud, cloud computing, network security, data center, disaster recovery center, cctv indoor, cctv outdoor, dedicated server, domain, hosting, domain hosting, lan, wan, fiber optic, intercity, dedicated line, peering, mpls, ip transit, ipv4, ipv6, management information system, information system, mis, indonesia, project, information enginering, tenaga ahli, ngo, open source, Online Project Management, Project Scope, Web Project Management,Project Risk Management,Project Management Consulting,Project Management Tools,Project Management Planning, IT project management, IT project performance management';
		$uri_segment = 3;
		
		if($offset != 0){
			$offset = $this->uri->segment($uri_segment);
		}else{
			$offset=$offset;
		}
		$num_post=10;
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['hasil']=$this->career_model->getData($num_post, $offset);
		$data['offset']=$offset;
		$num_rows = $this->career_model->count_all_num_rows();
			
		if($num_rows>0){
			// Membuat pagination
			$config['base_url'] = base_url().'main/all_career';
			$config['cur_tag_open'] = '<li class=active><a href="#">';
			$config['cur_tag_close'] = '<span class="sr-only">(current)</span></a></li>';
			$config['num_tag_open'] = '<li>';
			$config['num_tag_close'] = '</li>';
			$config['prev_link'] = '<';
			$config['prev_tag_open'] = '<li>';
			$config['prev_tag_close'] = '</li>';
			$config['next_link'] = '>';
			$config['next_tag_open'] = '<li>';
			$config['next_tag_close'] = '</li>';
			//buat last
			$config['last_tag_open'] = '<li>';
			$config['last_tag_close'] = '</li>';
			$config['last_link'] = '>>';
			//buat first
			$config['first_tag_open'] = '<li>';
			$config['first_tag_close'] = '</li>';
			$config['first_link'] = '<<';
			$config['total_rows'] = $num_rows;
			$config['per_page'] = $num_post;
			$config['num_links'] = 3;
			$config['uri_segment'] = $uri_segment;
			$this->pagination->initialize($config);
			$data['pagination'] = $this->pagination->create_links();
		}
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		$this->load->view('home',$data);
	}
	
	function all_portofolio($offset = 0){
		$data['judul']='Portofolio | Time Excelindo';
		$data['main_content']='all_portofolio';
		//buat meta deskripsi
		$data['meta_deskripsi']='ICT Service Provider';
		$data['seo_gambar']=base_url()."asset/images/logo_te.jpg";
		$data['meta_tags']='te,TE,time excelindo,Time Excelindo, timeexcelindo, TimeExcelindo, website, website enterprise, sms, sms center, airport system, airport pas, airport pas management system, airport safety, aiport safety management system, smartcard, smart card, rfid, rfid solution, file payment for banking, file payment banking, converter payment banking, build software, costome software, build costome software, system integration, mobile application, cobit implementation, itil implementation, service management, risk management, cloud, cloud computing, network security, data center, disaster recovery center, cctv indoor, cctv outdoor, dedicated server, domain, hosting, domain hosting, lan, wan, fiber optic, intercity, dedicated line, peering, mpls, ip transit, ipv4, ipv6, management information system, information system, mis, indonesia, project, information enginering, tenaga ahli, ngo, open source, Online Project Management, Project Scope, Web Project Management,Project Risk Management,Project Management Consulting,Project Management Tools,Project Management Planning, IT project management, IT project performance management';
		$uri_segment = 3;
		
		if($offset != 0){
			$offset = $this->uri->segment($uri_segment);
		}else{
			$offset=$offset;
		}
		$num_post=10;
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['hasil']=$this->portofolio_model->getData1($num_post, $offset);
		$data['offset']=$offset;
		$num_rows = $this->portofolio_model->count_all_num_rows();
			
		if($num_rows>0){
			// Membuat pagination
			$config['base_url'] = base_url().'main/all_portofolio';
			$config['cur_tag_open'] = '<li class=active><a href="#">';
			$config['cur_tag_close'] = '<span class="sr-only">(current)</span></a></li>';
			$config['num_tag_open'] = '<li>';
			$config['num_tag_close'] = '</li>';
			$config['prev_link'] = '<<';
			$config['prev_tag_open'] = '<li>';
			$config['prev_tag_close'] = '</li>';
			$config['next_link'] = '>>';
			$config['next_tag_open'] = '<li>';
			$config['next_tag_close'] = '</li>';
			//buat last
			$config['last_tag_open'] = '<li>';
			$config['last_tag_close'] = '</li>';
			$config['last_link'] = '>';
			//buat first
			$config['first_tag_open'] = '<li>';
			$config['first_tag_close'] = '</li>';
			$config['first_link'] = '<';
			$config['total_rows'] = $num_rows;
			$config['per_page'] = $num_post;
			$config['num_links'] = 3;
			$config['uri_segment'] = $uri_segment;
			$this->pagination->initialize($config);
			$data['pagination'] = $this->pagination->create_links();
		}
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		$this->load->view('home',$data);
	}

	function all_products($offset = 0){
		$data['judul']='Products | Time Excelindo';
		$data['main_content']='all_products';
		//buat meta deskripsi
		$data['meta_deskripsi']='ICT Service Provider';
		$data['seo_gambar']=base_url()."asset/images/logo_te.jpg";
		$data['meta_tags']='te,TE,time excelindo,Time Excelindo, timeexcelindo, TimeExcelindo, website, website enterprise, sms, sms center, airport system, airport pas, airport pas management system, airport safety, aiport safety management system, smartcard, smart card, rfid, rfid solution, file payment for banking, file payment banking, converter payment banking, build software, costome software, build costome software, system integration, mobile application, cobit implementation, itil implementation, service management, risk management, cloud, cloud computing, network security, data center, disaster recovery center, cctv indoor, cctv outdoor, dedicated server, domain, hosting, domain hosting, lan, wan, fiber optic, intercity, dedicated line, peering, mpls, ip transit, ipv4, ipv6, management information system, information system, mis, indonesia, project, information enginering, tenaga ahli, ngo, open source, Online Project Management, Project Scope, Web Project Management,Project Risk Management,Project Management Consulting,Project Management Tools,Project Management Planning, IT project management, IT project performance management';
		$uri_segment = 3;
		
		if($offset != 0){
			$offset = $this->uri->segment($uri_segment);
		}else{
			$offset=$offset;
		}
		$num_post=10;
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['hasil']=$this->portofolio_model->getData2($num_post, $offset);
		$data['offset']=$offset;
		$num_rows = $this->portofolio_model->count_all_num_rows();
			
		if($num_rows>0){
			// Membuat pagination
			$config['base_url'] = base_url().'main/all_products';
			$config['cur_tag_open'] = '<li class=active><a href="#">';
			$config['cur_tag_close'] = '<span class="sr-only">(current)</span></a></li>';
			$config['num_tag_open'] = '<li>';
			$config['num_tag_close'] = '</li>';
			$config['prev_link'] = '<';
			$config['prev_tag_open'] = '<li>';
			$config['prev_tag_close'] = '</li>';
			$config['next_link'] = '>';
			$config['next_tag_open'] = '<li>';
			$config['next_tag_close'] = '</li>';
			//buat last
			$config['last_tag_open'] = '<li>';
			$config['last_tag_close'] = '</li>';
			$config['last_link'] = '>>';
			//buat first
			$config['first_tag_open'] = '<li>';
			$config['first_tag_close'] = '</li>';
			$config['first_link'] = '<<';
			$config['total_rows'] = $num_rows;
			$config['per_page'] = $num_post;
			$config['num_links'] = 3;
			$config['uri_segment'] = $uri_segment;
			$this->pagination->initialize($config);
			$data['pagination'] = $this->pagination->create_links();
		}
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		$this->load->view('home',$data);
	}
	
	function career($offset = 0){
		//echo 'masuk sini';
		$data['judul']='Career | Time Excelindo';
		//buat meta deskripsi
		$data['meta_deskripsi']='ICT Service Provider';
		$data['seo_gambar']=base_url()."asset/images/logo_te.jpg";
		$data['meta_tags']='te,TE,time excelindo,Time Excelindo, timeexcelindo, TimeExcelindo, website, website enterprise, sms, sms center, airport system, airport pas, airport pas management system, airport safety, aiport safety management system, smartcard, smart card, rfid, rfid solution, file payment for banking, file payment banking, converter payment banking, build software, costome software, build costome software, system integration, mobile application, cobit implementation, itil implementation, service management, risk management, cloud, cloud computing, network security, data center, disaster recovery center, cctv indoor, cctv outdoor, dedicated server, domain, hosting, domain hosting, lan, wan, fiber optic, intercity, dedicated line, peering, mpls, ip transit, ipv4, ipv6, management information system, information system, mis, indonesia, project, information enginering, tenaga ahli, ngo, open source, Online Project Management, Project Scope, Web Project Management,Project Risk Management,Project Management Consulting,Project Management Tools,Project Management Planning, IT project management, IT project performance management';
		$hasil=$this->main_model->get_career_active();
		$num_post=10;
		
		if(count($hasil)>1){
			$data['main_content']='career';
			$data['hasil']=$hasil;
		}elseif(count($hasil)==1){
			//echo 'hanya 1';
			$data['main_content']='career_satu';
			$data['hasil']=$hasil;
		}else{
			//echo 'ada';
			$data['main_content']='arsip_career';
			$data['offset']=$offset;
			$uri_segment = 3;
			if($offset != 0){
				$offset = $this->uri->segment($uri_segment);
			}else{
				$offset=$offset;
			}
			
			$num_post=10;
			$data['hasil']=$this->career_model->getData($num_post, $offset);
			$data['offset']=$offset;
			$num_rows = $this->career_model->count_all_num_rows();
			
			if($num_rows>0){
				// Membuat pagination
				$config['base_url'] = base_url().'main/career';
				$config['cur_tag_open'] = '<li class=active><a href="#">';
				$config['cur_tag_close'] = '<span class="sr-only">(current)</span></a></li>';
				$config['num_tag_open'] = '<li>';
				$config['num_tag_close'] = '</li>';
				$config['prev_link'] = '<';
				$config['prev_tag_open'] = '<li>';
				$config['prev_tag_close'] = '</li>';
				$config['next_link'] = '>';
				$config['next_tag_open'] = '<li>';
				$config['next_tag_close'] = '</li>';
				//buat last
				$config['last_tag_open'] = '<li>';
				$config['last_tag_close'] = '</li>';
				$config['last_link'] = '>>';
				//buat first
				$config['first_tag_open'] = '<li>';
				$config['first_tag_close'] = '</li>';
				$config['first_link'] = '<<';
				$config['total_rows'] = $num_rows;
				$config['per_page'] = $num_post;
				$config['num_links'] = 3;
				$config['uri_segment'] = $uri_segment;
				$this->pagination->initialize($config);
				$data['pagination'] = $this->pagination->create_links();
			}
		}
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		$this->load->view('home',$data);
	}
	
	function detail_page(){
		$id=$this->uri->segment(2);
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['hasil']=$this->main_model->get_detail_page($id);
		$data['status']=$this->uri->segment(3);;
		if(count($data['hasil'])>0){
			$data['main_content']='detail_page';
			$tmp_konten=strip_tags($data['hasil']['konten']);
			$konten = word_limiter($tmp_konten, 20);
			//buat meta deskripsi
			$data['meta_deskripsi']=$konten;
			$data['meta_tags']=$data['hasil']['tags'];
			$data['seo_url']=site_url('page/'.$data['hasil']['slug']);
			$data['seo_tanggal']=$data['hasil']['tgl_posting'];
			$data['judul']=$data['hasil']['judul']." | Time Excelindo";

			// load the session library
			$this->load->library('session');
			$this->load->helper(array('captcha','url'));
 			
 			if($data['hasil']['slug'] == 'contact-us'){
        // load codeigniter captcha helper
        $this->load->helper('captcha');

        $vals = array(
            'img_path'	 => './captcha/',
            'img_url'	 => base_url().'captcha/',
            'img_width'	 => '200',
            'img_height' => 30,
            'border' => 0, 
            'expiration' => 7200
        );

        // create captcha image
        $cap = create_captcha($vals);

        // store image html code in a variable
        $data['image'] = $cap['image'];

        // store the captcha word in a session
        $this->session->set_userdata('captcha', $cap['word']);
        $data['ses'] = $this->session->userdata('captcha');
      }
		}else{
			$data['judul']='Halaman Tidak Ada';
			$data['main_content']='not_found';
		}
		
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		
		$this->load->view('home',$data);
	}
	
	function detail_slider(){
		$id=$this->uri->segment(2);
		//echo 'idku '.$id;
		$data['main_content']='detail_slider';
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['hasil']=$this->main_model->get_detail_slider($id);
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		$data['judul']=$data['hasil']['judul']." | Time Excelindo";
		//buat meta deskripsi
		$tmp_konten=strip_tags($data['hasil']['konten']);
		$konten = word_limiter($tmp_konten, 20);
		$data['meta_deskripsi']=$konten;
		$data['meta_tags']=$data['hasil']['tags'];
		$this->load->view('home',$data);
	}
	
	function detail_career(){
		$id=$this->uri->segment(2);
		//echo 'idku '.$id;
		
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['hasil']=$this->main_model->get_detail_career($id);
		if(count($data['hasil'])>0){
			$data['judul']=$data['hasil']['judul']." | Time Excelindo";
			$data['seo_gambar']=base_url()."asset/images/logo.png";
			$data['seo_tanggal']=$data['hasil']['tgl_posting'];
			$data['seo_url']=site_url('detail_career/'.$data['hasil']['slug']);
			$data['main_content']='detail_career';
			$tmp_konten=strip_tags($data['hasil']['konten']);
			$konten = word_limiter($tmp_konten, 20);
			$data['meta_deskripsi']=$konten;
		}else{
			$data['judul']='Halaman Tidak Ada';
			$data['main_content']='not_found';
		}
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		//print_r($data['hasil']);
		
		$this->load->view('home',$data);
	}
	
	function detail_produk(){
		$id=$this->uri->segment(2);
		$data['main_content']='detail_produk';
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['hasil']=$this->main_model->get_detail_produk($id);
		
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		if(count($data['hasil'])>0){
			//buat meta deskripsi
			$data['judul']=$data['hasil']['judul']." | Time Excelindo";
			if($data['hasil']['deskripsi']!=""){
				$konten=$data['hasil']['deskripsi'];
			}else{
				$tmp_konten=strip_tags($data['hasil']['konten']);
				$konten = word_limiter($tmp_konten, 20);
			}
			$data['meta_deskripsi']=$konten;
			//buat seo gambar
			if($data['hasil']['gambar']==""){
				$gambar="default.jpg";
			}else{
				$gambar=$data['hasil']['gambar'];
			}
			if($data['hasil']['id_parent'] == '0'){
				$data['list_products']=$this->main_model->get_produk_parent($data['hasil']['id_produk']);
				//print_r($data['list_produk']);
			}
			$data['seo_gambar']=base_url()."foto_produk/".$gambar;
			$data['seo_url']=site_url('products/'.$data['hasil']['slug']);
			$data['seo_tanggal']=$data['hasil']['tgl_posting'];
			$data['meta_tags']=$data['hasil']['tags'];
			$tmp_konten=strip_tags($data['hasil']['konten']);
			$konten = word_limiter($tmp_konten, 20);
			$data['meta_deskripsi']=$konten;
		}else{
			$data['judul']='Halaman Tidak Ada';
			$data['main_content']='not_found';
		}
		$this->load->view('home',$data);
	}
	
	function detail_news(){
		//$data['main_content']='detail_news';
		$id=$this->uri->segment(2);
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['hasil']=$this->main_model->get_detail_news($id);
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		if(count($data['hasil'])>0){
			$tampil_sidebar=$data['hasil']['pilihan_sidebar'];
			if($tampil_sidebar=='ya'){
				$data['main_content']='detail_news';
			}else{
				$data['main_content']='konten_single';
			}
			$data['judul']=$data['hasil']['judul']." | Time Excelindo";
			
			//buat meta deskripsi
			$tmp_konten=strip_tags($data['hasil']['konten']);
			$konten = word_limiter($tmp_konten, 20);
			$data['meta_deskripsi']=$konten;
			//buat seo gambar
			if($data['hasil']['gambar']==""){
				$gambar="default.jpg";
			}else{
				$gambar=$data['hasil']['gambar'];
			}
			$hasil['seo_gambar']=base_url()."foto_post/".$gambar;
			$data['seo_url']=site_url('news/'.$data['hasil']['slug']);
			$data['seo_tanggal']=$data['hasil']['tgl_posting'];
			$data['meta_tags']=$data['hasil']['tags'];
		}else{
			$data['judul']='Halaman Tidak Ada';
			$data['main_content']='not_found';
		}
		
		$this->load->view('home',$data);
	}
	
	function detail_portofolio(){
		
		$id=$this->uri->segment(2);
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['hasil']=$this->main_model->get_detail_portofolio($id);
		
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		if(count($data['hasil'])>0){
			$data['main_content']='detail_portofolio';
			$data['judul']=$data['hasil']['judul']." | Time Excelindo";
			//buat meta deskripsi
			$tmp_konten=strip_tags($data['hasil']['konten']);
			$konten = word_limiter($tmp_konten, 20);
			$data['meta_deskripsi']=$konten;
			//buat seo gambar
			if($data['hasil']['gambar']==""){
				$gambar="default.jpg";
			}else{
				$gambar=$data['hasil']['gambar'];
			}
			$data['seo_gambar']=base_url()."foto_portofolio/".$gambar;
			//echo 'gambarku '.$data['seo_gambar'];
			$data['meta_tags']=$data['hasil']['tags'];
			$data['seo_url']=site_url('portofolio/'.$data['hasil']['slug']);
			$data['seo_tanggal']=$data['hasil']['tgl_posting'];
		}else{
			$data['judul']='Halaman Tidak Ada';
			$data['main_content']='not_found';
		}
		
		$this->load->view('home',$data);
	}

	function detail_products(){
		
		$id=$this->uri->segment(2);
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['hasil']=$this->main_model->get_detail_products($id);
		$data['tentang']=$this->main_model->get_detail_page('about-us');

		if(count($data['hasil'])>0){
			$data['main_content']='detail_products';
			$data['judul']=$data['hasil']['judul']." | Time Excelindo";
			
			//buat meta deskripsi
			$tmp_konten=strip_tags($data['hasil']['konten']);
			$konten = word_limiter($tmp_konten, 20);
			$data['meta_deskripsi']=$konten;
			//buat seo gambar
			if($data['hasil']['gambar']==""){
				$gambar="default.jpg";
			}else{
				$gambar=$data['hasil']['gambar'];
			}
			$data['seo_gambar']=base_url()."foto_portofolio/".$gambar;
			//echo 'gambarku '.$data['seo_gambar'];
			$data['meta_tags']=$data['hasil']['tags'];
			$data['seo_url']=site_url('products/'.$data['hasil']['slug']);
			$data['seo_tanggal']=$data['hasil']['tgl_posting'];
		}else{
			$data['judul']='Halaman Tidak Ada';
			$data['main_content']='not_found';
		}
		
		$this->load->view('home',$data);
	}
	
	function not_found(){
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		$data['judul']='Halaman Tidak Ada';
		$data['main_content']='not_found';
		//buat meta deskripsi
		$data['meta_deskripsi']='ICT Service Provider';
		$data['seo_gambar']=base_url()."asset/images/logo_te.jpg";
		$data['meta_tags']='te,TE,time excelindo,Time Excelindo, timeexcelindo, TimeExcelindo, website, website enterprise, sms, sms center, airport system, airport pas, airport pas management system, airport safety, aiport safety management system, smartcard, smart card, rfid, rfid solution, file payment for banking, file payment banking, converter payment banking, build software, costome software, build costome software, system integration, mobile application, cobit implementation, itil implementation, service management, risk management, cloud, cloud computing, network security, data center, disaster recovery center, cctv indoor, cctv outdoor, dedicated server, domain, hosting, domain hosting, lan, wan, fiber optic, intercity, dedicated line, peering, mpls, ip transit, ipv4, ipv6, management information system, information system, mis, indonesia, project, information enginering, tenaga ahli, ngo, open source, Online Project Management, Project Scope, Web Project Management,Project Risk Management,Project Management Consulting,Project Management Tools,Project Management Planning, IT project management, IT project performance management';
		$this->load->view('home',$data);
	}

	function sendemail(){
		$this->load->library('email');

		$nama=$this->input->post('nama');
		$subject=$this->input->post('subject');
		$email=$this->input->post('email');
		$pesan=$this->input->post('pesan');
		$captcha1 = $this->input->post('security_code');
		$captcha2 = $this->input->post('captcha2');
		if($captcha1 == "$captcha2"){
			$this->email->from("$email", "$nama");
			$this->email->to("dibyo.sudarsono91@gmail.com");
			$this->email->subject("$subject");
			$this->email->message("$pesan");
			$this->email->send();
			$this->session->set_flashdata('pesan_sukses', 'Send Message Success');
			redirect('page/contact-us/success');
		}else{
			$this->session->set_flashdata('pesan_gagal', 'Invalid Captcha Code');
			redirect("page/contact-us/failed");
		}
	}
	
	function statistik(){
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		
		$data['list_chart'] = $this->jclient_model->getData4JSonDetail();
		
		$data['judul']='Statistik Client dan Pekerjaan';
		$data['main_content']='detail_chart';		
	
		//buat meta deskripsi
		$data['meta_deskripsi']='Statistik Client dan Pekerjaan dari Time Excellindo - ICT Service Provider';
		$data['seo_gambar']=base_url()."asset/images/logo_te.jpg";
		$data['meta_tags']='te,TE,time excelindo,Time Excelindo, timeexcelindo, TimeExcelindo, website, website enterprise, sms, sms center, airport system, airport pas, airport pas management system, airport safety, aiport safety management system, smartcard, smart card, rfid, rfid solution, file payment for banking, file payment banking, converter payment banking, build software, costome software, build costome software, system integration, mobile application, cobit implementation, itil implementation, service management, risk management, cloud, cloud computing, network security, data center, disaster recovery center, cctv indoor, cctv outdoor, dedicated server, domain, hosting, domain hosting, lan, wan, fiber optic, intercity, dedicated line, peering, mpls, ip transit, ipv4, ipv6, management information system, information system, mis, indonesia, project, information enginering, tenaga ahli, ngo, open source, Online Project Management, Project Scope, Web Project Management,Project Risk Management,Project Management Consulting,Project Management Tools,Project Management Planning, IT project management, IT project performance management';
		$this->load->view('home',$data);
	}

	function grafik(){
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		$data['list_pekerjaan'] = $this->jpekerjaan_model->getData4JSonDetail();
		
		$data['judul']='Statistik Client dan Pekerjaan';
		$data['main_content']='grafik';		
	
		//buat meta deskripsi
		$data['meta_deskripsi']='Statistik Client dan Pekerjaan dari Time Excellindo - ICT Service Provider';
		$data['seo_gambar']=base_url()."asset/images/logo_te.jpg";
		$data['meta_tags']='te,TE,time excelindo,Time Excelindo, timeexcelindo, TimeExcelindo, website, website enterprise, sms, sms center, airport system, airport pas, airport pas management system, airport safety, aiport safety management system, smartcard, smart card, rfid, rfid solution, file payment for banking, file payment banking, converter payment banking, build software, costome software, build costome software, system integration, mobile application, cobit implementation, itil implementation, service management, risk management, cloud, cloud computing, network security, data center, disaster recovery center, cctv indoor, cctv outdoor, dedicated server, domain, hosting, domain hosting, lan, wan, fiber optic, intercity, dedicated line, peering, mpls, ip transit, ipv4, ipv6, management information system, information system, mis, indonesia, project, information enginering, tenaga ahli, ngo, open source, Online Project Management, Project Scope, Web Project Management,Project Risk Management,Project Management Consulting,Project Management Tools,Project Management Planning, IT project management, IT project performance management';
		$this->load->view('home',$data);
	}

	function magang(){
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		$data['judul']='Informasi Magang';
		$data['main_content']='magang';
		//buat meta deskripsi
		$data['meta_deskripsi']='ICT Service Provider';
		$data['seo_gambar']=base_url()."asset/images/logo_te.jpg";
		$data['meta_tags']='te,TE,time excelindo,Time Excelindo, timeexcelindo, TimeExcelindo, website, website enterprise, sms, sms center, airport system, airport pas, airport pas management system, airport safety, aiport safety management system, smartcard, smart card, rfid, rfid solution, file payment for banking, file payment banking, converter payment banking, build software, costome software, build costome software, system integration, mobile application, cobit implementation, itil implementation, service management, risk management, cloud, cloud computing, network security, data center, disaster recovery center, cctv indoor, cctv outdoor, dedicated server, domain, hosting, domain hosting, lan, wan, fiber optic, intercity, dedicated line, peering, mpls, ip transit, ipv4, ipv6, management information system, information system, mis, indonesia, project, information enginering, tenaga ahli, ngo, open source, Online Project Management, Project Scope, Web Project Management,Project Risk Management,Project Management Consulting,Project Management Tools,Project Management Planning, IT project management, IT project performance management';
		
		$data['hasil']=$this->main_model->magang();
		$this->load->view('home',$data);
	}

	function pendaftaran_magang(){
		$data['list_portofolio']=$this->main_model->get_portofolio();
		$data['list_produk']=$this->main_model->get_products();
		$data['tentang']=$this->main_model->get_detail_page('about-us');
		$data['judul']='Pendaftaran Magang';
		$data['main_content']='pendaftaran_magang';
		//buat meta deskripsi
		$data['meta_deskripsi']='ICT Service Provider';
		$data['seo_gambar']=base_url()."asset/images/logo_te.jpg";
		$data['meta_tags']='te,TE,time excelindo,Time Excelindo, timeexcelindo, TimeExcelindo, website, website enterprise, sms, sms center, airport system, airport pas, airport pas management system, airport safety, aiport safety management system, smartcard, smart card, rfid, rfid solution, file payment for banking, file payment banking, converter payment banking, build software, costome software, build costome software, system integration, mobile application, cobit implementation, itil implementation, service management, risk management, cloud, cloud computing, network security, data center, disaster recovery center, cctv indoor, cctv outdoor, dedicated server, domain, hosting, domain hosting, lan, wan, fiber optic, intercity, dedicated line, peering, mpls, ip transit, ipv4, ipv6, management information system, information system, mis, indonesia, project, information enginering, tenaga ahli, ngo, open source, Online Project Management, Project Scope, Web Project Management,Project Risk Management,Project Management Consulting,Project Management Tools,Project Management Planning, IT project management, IT project performance management';
		
		$data['hasil']=$this->main_model->magang();
		$this->load->view('home',$data);
	}

	function proses_daftar(){
		$this->load->library('email');

		$nama=$this->input->post('nama');
		$subject=$this->input->post('subject');
		$email=$this->input->post('email');
		$pesan=$this->input->post('pesan');
		$captcha1 = $this->input->post('security_code');
		$captcha2 = $this->input->post('captcha2');
		if($captcha1 == "$captcha2"){
			$this->email->from("$email", "$nama");
			$this->email->to("dibyo.sudarsono91@gmail.com");
			$this->email->subject("$subject");
			$this->email->message("$pesan");
			$this->email->send();
			$this->session->set_flashdata('pesan_sukses', 'Send Message Success');
			redirect('main');
		}else{
			$this->session->set_flashdata('pesan_gagal', 'Invalid Captcha Code');
			redirect("main");
		}
	}
}